package com.doit.demo01;

import java.math.BigInteger;

public class test_BigInteger {
    public static void main(String[] args) {
        BigInteger b1 = new BigInteger("30215464605561650640");
        BigInteger b2 = new BigInteger("34132434243");

        //加法
        System.out.println(b1.add(b2));
        //减法
        System.out.println(b1.subtract(b2));
        //乘法
        System.out.println(b1.multiply(b2));
        //除法
        System.out.println(b1.divide(b2));//只要整数,小数直接舍去

        System.out.println("------------------------");
        BigInteger b = new BigInteger("123");
        System.out.println(b.longValue());//如果long类型能放的下,就能打印
        System.out.println(b.intValue());//如果int类型能放的下,就打印
    }
}
